﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using HumanManagement.BusinessObjects;
using HumanManagement.DataAccess;

namespace HumanManagement.BusinessLogic
{
	public class UserSubFunctionBL
	{

		#region ***** Init Methods ***** 
		UserSubFunctionDA objUserSubFunctionDA;
		public UserSubFunctionBL()
		{
			objUserSubFunctionDA = new UserSubFunctionDA();
		}
		#endregion

		#region ***** Get Methods ***** 
		/// <summary>
		/// Get UserSubFunction by id
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns>UserSubFunction</returns>
		public UserSubFunction GetByID(int id)
		{
			return objUserSubFunctionDA.GetByID(id);
		}

		/// <summary>
		/// Get all of UserSubFunction
		/// </summary>
		/// <returns>List<<UserSubFunction>></returns>
		public List<UserSubFunction> GetList()
		{
			string cacheName = "lstUserSubFunction";
			if( ServerCache.Get(cacheName) == null )
			{
				ServerCache.Insert(cacheName, objUserSubFunctionDA.GetList(), "UserSubFunction");
			}
			return (List<UserSubFunction>) ServerCache.Get(cacheName);
		}

		/// <summary>
		/// Get DataSet of UserSubFunction
		/// </summary>
		/// <returns>DataSet</returns>
		public DataSet GetDataSet()
		{
			string cacheName = "dsUserSubFunction";
			if( ServerCache.Get(cacheName) == null )
			{
				ServerCache.Insert(cacheName, objUserSubFunctionDA.GetDataSet(), "UserSubFunction");
			}
			return (DataSet) ServerCache.Get(cacheName);
		}


		/// <summary>
		/// Get all of UserSubFunction paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>List<<UserSubFunction>></returns>
		public List<UserSubFunction> GetListPaged(int recperpage, int pageindex)
		{
			return objUserSubFunctionDA.GetListPaged(recperpage, pageindex);
		}

		/// <summary>
		/// Get DataSet of UserSubFunction paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>DataSet</returns>
		public DataSet GetDataSetPaged(int recperpage, int pageindex)
		{
			return objUserSubFunctionDA.GetDataSetPaged(recperpage, pageindex);
		}





		#endregion

		#region ***** Add Update Delete Methods ***** 
		/// <summary>
		/// Add a new UserSubFunction within UserSubFunction database table
		/// </summary>
		/// <param name="obj_usersubfunction">UserSubFunction</param>
		/// <returns>key of table</returns>
		public int Add(UserSubFunction obj_usersubfunction)
		{
			ServerCache.Remove("UserSubFunction", true);
			return objUserSubFunctionDA.Add(obj_usersubfunction);
		}

		/// <summary>
		/// updates the specified UserSubFunction
		/// </summary>
		/// <param name="obj_usersubfunction">UserSubFunction</param>
		/// <returns></returns>
		public void Update(UserSubFunction obj_usersubfunction)
		{
			ServerCache.Remove("UserSubFunction", true);
			objUserSubFunctionDA.Update(obj_usersubfunction);
		}

		/// <summary>
		/// Delete the specified UserSubFunction
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns></returns>
		public void Delete(int id)
		{
			ServerCache.Remove("UserSubFunction", true);
			objUserSubFunctionDA.Delete(id);
		}
		#endregion
	}
}
